# -*- coding:utf-8 -*-

from __future__ import absolute_import, unicode_literals
import os

from django.conf import settings
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')  # 设置django环境

app = Celery('apps.user')

# 配置应用
app.conf.update(
    # 配置broker, 这里我们用redis作为broker
    BROKER_URL=settings.CELERY_BROKER_URL,
)

# 设置app自动加载任务
# 从已经安装的app中查找任务
app.autodiscover_tasks(settings.INSTALLED_APPS)
